import * as ActionTypes from './ActionTypes';

import axios from 'axios';

const axiosCfg = {
    async getApi(getCfg){
        let data = await axios.get(getCfg.url,{params:getCfg.cfg},
        {
            headers: getCfg.headers
        })
        return data;
    }
}

export const getList = (text,bbbData) =>{
    return {
        type:ActionTypes.GET_LISTSS,
        text:text,
        listData:bbbData
    }
}
export const getApi = (text,getCfg,dispatch) =>{
    return {
        type:ActionTypes.GET_API,
        text:text,
        ajaxFn:axiosCfg.getApi(getCfg).then((res)=>{
            console.log(res.data)
            dispatch(getList('回调',res.data))
        })
    }
}
